package easy;

public class Solution_2000 {

    public String reversePrefix(String word, char ch) {
        char[] chars = word.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] == ch) {
                for (int j = 0, k = i; j < k; j++, k--) {
                    char c = chars[j];
                    chars[j] = chars[k];
                    chars[k] = c;
                }
                break;
            }
        }
        return new String(chars);
    }

    public static void main(String[] args) {
        Solution_2000 model = new Solution_2000();
        System.out.println(model.reversePrefix("abcdefd", 'd'));
        System.out.println(model.reversePrefix("xyxzxe", 'z'));
    }
}
